﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Devsoft.DB.Models.Crypto
{
    public interface ICryptoService
    {
        string Encrypt(object val);
        object Decrypt(string src);
        object Decrypt<T>(string src);
    }

    public class CryptoService
    {
        private static ICryptoService _service = new SimpleService(System.Reflection.Assembly.GetExecutingAssembly().Location);

        public static void Register(ICryptoService service)
        {
            _service = service;
        }

        public static ICryptoService Default
        {
            get
            {
                if (_service == null)
                {
                    throw new Exception("No CryptoService registered");
                }
                return _service;
            }
        }


    }
}
